package de.deilab.prefgen.example;

import de.dailab.prefgen.BooleanEnumLeaf;
import de.dailab.prefgen.DefaultNameMapper;
import de.dailab.prefgen.EnumLeaf;
import de.dailab.prefgen.PreferenceFactory;
import de.dailab.prefgen.SeekBarIntegerLeaf;
import de.dailab.prefgen.TextLeaf;
import de.dailab.prefgen.example.R;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;

public class SportsNewsSubscription extends PreferenceActivity {

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	
		News news = new News();
		Sport sport = new Sport();
		sport.setKind("Football");
		sport.setWebsite("fussball.de");
		Sport sport2 = new Sport();
		sport2.setKind("Basketball");
		sport2.setWebsite("basketball-bundesliga.de");
		news.addSportNews(sport);
		news.addSportNews(sport2);
		
		news.setRateService(0);
		
		final PreferenceFactory preferenceFactory = new PreferenceFactory(
				this, new DefaultNameMapper());
		preferenceFactory.addLeaf(new TextLeaf());
		preferenceFactory.addLeaf(new BooleanEnumLeaf());
		preferenceFactory.addLeaf(new EnumLeaf());
		preferenceFactory.addLeaf(new SeekBarIntegerLeaf());

		final PreferenceScreen preferenceScreen = getPreferenceManager()
				.createPreferenceScreen(this);
		setPreferenceScreen(preferenceScreen);
		
		preferenceFactory.generate(news, preferenceScreen);
	}
			
}
